import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import HospitalMap from '../components/HospitalMap';

function SelectHospitalMapPage({ dispatch }) {
  function onSelectHosptitalSuccess(hospital) {
    dispatch({
      type: 'physicianAuth/selectLocSuccess',
      payload: hospital,
    });
    dispatch(routerRedux.push('/physicianAuth'));
  }

  return (
    <div style={{ width: '100%', height: '600px' }}>
      <HospitalMap onSelectHosptital={onSelectHosptitalSuccess} />
    </div>
  );
}

export default connect()(SelectHospitalMapPage);
